package org.demo.service.impl;

import org.demo.mapper.OrderIdMapper;
import org.demo.service.IOrderIdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class OrderIdServiceImpl implements IOrderIdService {

    @Autowired
    private OrderIdMapper orderIdMapper;

    @Override
    public String getId(String key) {
        Map<String,String> map=new HashMap<>();
        map.put("invalue",key);
        map.put("rsvalue","");
        orderIdMapper.getId(map);
        String outValue = map.get("rsvalue");
        if(outValue.equals("X")||outValue.equals("")){
            throw  new RuntimeException(key+"编号获取失败");
        }
        return outValue;
    }
}
